﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Vit.SchemaExplorer
{
    [Serializable]
    public class StoredProcedureSchema : CommandSchema
    {
        public override CommandObjectType CommandType
        {
            get { return CommandObjectType.StoredProcedure; }
        }

        public IEnumerable<ParameterSchema> InputParameters
        {
            get
            {
                return this.Parameters.Where(o => o.Direction == ParameterDirection.Input || o.Direction == ParameterDirection.InputOutput);
            }
        }

        public IEnumerable<ParameterSchema> OutputParameters
        {
            get
            {
                return this.Parameters.Where(o => o.Direction == ParameterDirection.Output || o.Direction == ParameterDirection.InputOutput);
            }
        }

        public ParameterSchema ReturnParameter
        {
            get
            {
                return this.Parameters.FirstOrDefault(o => o.Direction == ParameterDirection.ReturnValue);
            }
        }
    }
}
